package contact.view.util;

import java.util.ArrayList;
import java.util.Hashtable;

import util.math.RandomElement;

import model.db.VerticalResult;

public class Comparissons {

	/**
	 * @param args
	 */
	
	public ArrayList<long []> sequence  = new ArrayList<long[]>();
	
	boolean againtsGoogle=true;
	
	public Comparissons(boolean againtsGoogle, ArrayList<ArrayList<VerticalResult>>  list_results,  Hashtable<Long, ArrayList<VerticalResult>> organized ){
		
		this.againtsGoogle= againtsGoogle;
		if(this.againtsGoogle){
			
			createSequenceGoogleBase(list_results, organized);
			
		}else{
			
			
		}
		
	}
	
	private void createSequenceGoogleBase(
			ArrayList<ArrayList<VerticalResult>> list_results,
			Hashtable<Long, ArrayList<VerticalResult>> organized) {
		// TODO Auto-generated method stub

		boolean googleAtLeft = RandomElement.getRandomBoolean();

		for (int i = 0; i < list_results.size(); i++) {

			ArrayList<VerticalResult> current_results = list_results.get(i);

			if (current_results.size() > 0) {
				if (current_results.get(0).getVertical_id() != SurveyLogic.GOOGLE_ID) {

					googleAtLeft = RandomElement.getRandomBoolean();

					long t[] = new long[2];
					if (googleAtLeft) {
						
						t[0] = organized.get(SurveyLogic.GOOGLE_ID).get(0)
								.getVertical_id();

						t[1] = current_results.get(0).getVertical_id();

					} else {
						t[1] = organized.get(SurveyLogic.GOOGLE_ID).get(0)
								.getVertical_id();

						t[0] = current_results.get(0).getVertical_id();

					}

					sequence.add(t);

				}
			}

		}

	}




	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
